package com.mindmax.wordmemory.service.impl;

import java.util.List;

import com.mindmax.wordmemory.domain.DataVocabularySource;
import com.mindmax.wordmemory.mapper.DataVocabularySourceMapper;
import com.mindmax.wordmemory.service.IDataVocabularySourceService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 词汇Service业务层处理
 * 
 * @author cabloy
 * @date 2024-04-16
 */
@Service
public class DataVocabularySourceServiceImpl implements IDataVocabularySourceService
{
    @Autowired
    private DataVocabularySourceMapper dataVocabularySourceMapper;

    /**
     * 查询词汇
     * 
     * @param id 词汇主键
     * @return 词汇
     */
    @Override
    public DataVocabularySource selectDataVocabularySourceById(Long id)
    {
        return dataVocabularySourceMapper.selectDataVocabularySourceById(id);
    }

    /**
     * 查询词汇列表
     * 
     * @param dataVocabularySource 词汇
     * @return 词汇
     */
    @Override
    public List<DataVocabularySource> selectDataVocabularySourceList(DataVocabularySource dataVocabularySource)
    {
        return dataVocabularySourceMapper.selectDataVocabularySourceList(dataVocabularySource);
    }

    /**
     * 新增词汇
     * 
     * @param dataVocabularySource 词汇
     * @return 结果
     */
    @Override
    public int insertDataVocabularySource(DataVocabularySource dataVocabularySource)
    {
        dataVocabularySource.setCreateTime(DateUtils.getNowDate());
        return dataVocabularySourceMapper.insertDataVocabularySource(dataVocabularySource);
    }

    /**
     * 修改词汇
     * 
     * @param dataVocabularySource 词汇
     * @return 结果
     */
    @Override
    public int updateDataVocabularySource(DataVocabularySource dataVocabularySource)
    {
        dataVocabularySource.setUpdateTime(DateUtils.getNowDate());
        return dataVocabularySourceMapper.updateDataVocabularySource(dataVocabularySource);
    }

    /**
     * 批量删除词汇
     * 
     * @param ids 需要删除的词汇主键
     * @return 结果
     */
    @Override
    public int deleteDataVocabularySourceByIds(Long[] ids)
    {
        return dataVocabularySourceMapper.deleteDataVocabularySourceByIds(ids);
    }

    /**
     * 删除词汇信息
     * 
     * @param id 词汇主键
     * @return 结果
     */
    @Override
    public int deleteDataVocabularySourceById(Long id)
    {
        return dataVocabularySourceMapper.deleteDataVocabularySourceById(id);
    }
}
